/**
 * 请求方法：
 * - 传入配置属性格式
 * options: {
 *  url: string,
 *  method: string,
 *  type: string,
 *  data: string,
 * }
 */

//请求地址
// const server_url = 'http://172.27.11.56:8080'
// const server_url = 'http://47.101.71.221:8080'
const server_url = 'http://121.199.14.107:8080'
const net = (options) => {
  return new Promise((resolve, reject) => {
    uni.request({
      url: `${server_url}${options.url}`,
      method: options.method,
      header: options.header,
      data: options.data,
      success: (res) => {
        resolve(res)
      },
      fail: (err) => {
        reject(err)
      },
    })
  })
}
export default net
